<?php

namespace App;

use Illuminate\Database\Eloquent\Model;

class Assorts extends Model
{
    protected $fillable = [
        'goods_id',
        'serial',
        'category',
        'size',
        'color',
        'state',
        'number',
        'price',
        'discount',
        'orderno',
        'img'
    ];

    public function Boxs()
    {
        return $this->belongsTo('App\Boxs','orderno','orderno');
    }

    public function Goods()
    {
        return $this->belongsTo('App\Goods','goods_id','id');
    }

    public function getStateAttribute($value)
    {
        return Dics::where('val',$value)->first();
    }

    public function Keeper()
    {
        return $this->belongsTo('App\User', 'keeper', 'id');
    }
}
